"""

"""
# 老张开车去东北
# 增加新功能：
"""
class Person:
    def __init__(self, name=""):
        self.name = name

    def go_to(self,position,vehicle):
        print(self.name,"去",position)
        vehicle.run()

class Car:
    def run(self):
        print("汽车嘟嘟嘟嘟嘟嘟嘟...在行驶")

class Airplane:
    def run(self):
        print("飞机嗖嗖嗖...在飞行")

lz = Person("老张")
car = Car()
lz.go_to("东北",car)
"""

class Person:

    def __init__(self,name=""):
        self.name = name

    def go_to(self,position,vehicle):
        print(self.name + "去" + position)
        if isinstance(vehicle,Vehicle):
            # 编码时：调用的是父
            # 运行时：调用的是子
            vehicle.transport()

class Vehicle:
    def transport(self):
        pass

class Car(Vehicle):
    # 重写：子类具有和父类相同的方法
    def transport(self):
        print("汽车嘟嘟嘟...在行驶")

class Airplane(Vehicle):
    # 重写的快捷键：ctrl + o
    def transport(self):
        print("飞机嗖嗖嗖...在飞行")

lz = Person("老张")
car = Car()
lz.go_to("东北",car)
airplane = Airplane()
lz.go_to("东北",airplane);